/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.wpi.first.wpilibj.templates.subsystems;

import edu.wpi.first.wpilibj.Compressor;
import edu.wpi.first.wpilibj.Solenoid;
import edu.wpi.first.wpilibj.command.Subsystem;

/**
 *
 * @author Jarrod Risley
 */

public class PneumaticSwerve extends Subsystem {
    // Put methods for controlling this subsystem
    // here. Call these from Commands.
    
    /*
     * Global Class Variables
     */
    private Compressor compressor;
    private Solenoid deploySwerveSolenoid;
    private Solenoid retractSwerveSolenoid;
    private String subsystemName;

    public void initDefaultCommand() {
        // Set the default command for a subsystem here.
        //setDefaultCommand(new MySpecialCommand());
    } // end initDefaltCommand
    
    
    // CONSTRUCTOR //
    
    
    /**
     * Creates the Pneumatic Swerve subsystem and starts the robot's compressor.
     * 
     * @param name The Subsystem's name.
     * @param compressorPort The port that turns the compressor on.
     * @param relayPort Pressure Gauge port.
     * @param solenoid1 Deploy port.
     * @param solenoid2 Retract port.
     */
    
    public PneumaticSwerve(String name, int compressorPort, int relayPort,
            int solenoid1, int solenoid2) {
        
        System.out.println("Creating PneumaticSwerve " + name);
            subsystemName = name;
        
        compressor = new Compressor(compressorPort, relayPort);
            compressor.start();
        
        deploySwerveSolenoid = new Solenoid(solenoid1);
        retractSwerveSolenoid = new Solenoid(solenoid2);
        
    } // end PneumaticSwerve Constructor
    
    
    // METHODS // 
    
    
    /**
     * Activates the Swerve drive. Use <code>true</code> for deploying and
     * <code>false</code> for retracting.
     * 
     * @param isDeployed True / False value to activate / deactivate swerve.
     */
    
    public void activateSwerve(boolean isDeployed) {
        
        deploySwerveSolenoid.set(isDeployed);
        retractSwerveSolenoid.set(!isDeployed);
        
    } // end activateSwerve
    
    /**
     * Checks the Deploy Solenoid to see if the subsystem is active.
     * 
     * @return True if the swerve wheels are down.
     */
    
    public boolean getSwerveState() {
        return deploySwerveSolenoid.get();
    } // end getSwerveState
    
} // end NeumaticSwerve
